package xubo.wangcaifeng.love.Utils

class XuboString(val str: String) {
  def toIntPlus: Int = {
    try {
      str.toInt
    } catch {
      case _: Exception => 0
    }
  }
  def toDoublePlus: Double = {
    try {
      str.toDouble
    } catch {
      case _: Exception => 0.0
    }
  }
}
object XuboString{

  /**
    * 定义一个隐式方法，将普通的String 隐式转换成 SheepString
    * @param str
    * @return
    */
  implicit def str2XuboString(str: String) = new XuboString(str)
}
